package handler

import (
	"github.com/gin-gonic/gin"
	"zg3yk/dao"
	"zg3yk/request"
)

func AddFouc(c *gin.Context) {
	var req request.AddFouc
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(200, gin.H{
			"code": 1000,
			"msg":  err.Error(),
			"data": nil,
		})
		return
	}
	userId := c.GetUint("userId")
	err := dao.AddFouc(int(userId), req.FoucId)
	if err != nil {
		c.JSON(200, gin.H{
			"code": 1000,
			"msg":  err.Error(),
			"data": nil,
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 0,
		"msg":  "成功",
		"data": nil,
	})
}
